package cn.dlc.com.account.service.impl;

import cn.dlc.com.account.dao.AccountDao;
import cn.dlc.com.account.entity.Account;
import cn.dlc.com.account.service.AccountService;
import io.seata.core.context.RootContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author 邓立川
 * @date 2021/1/12 16:53
 * @desc 添加当前类的描述信息
 */
@Service
@Transactional
public class AccountServiceIml implements AccountService {

    @Autowired
    private AccountDao accountDao;

    @Override
    public void save(Account account) {
        // 获取XID
        System.out.println(RootContext.getXID());
        accountDao.save(account);
        if("bank2error".equals(account.getAccountName())){
            throw new RuntimeException("bank2 异常了");
        }
    }


}
